package com.ekuaitu.kuaitu.adapter;

import android.content.Context;

import com.ekuaitu.kuaitu.R;
import com.ekuaitu.kuaitu.base.BaseRcAdapterHelper;
import com.ekuaitu.kuaitu.base.RcQuickAdapter;
import com.ekuaitu.kuaitu.bean.SettlementBikeDetailBean;
import com.ekuaitu.kuaitu.utils.TimeUtils;

/**
 * Created by Michael on 2016/10/19.
 */
public class ChooseBikeCouponAdapter extends RcQuickAdapter<SettlementBikeDetailBean.AttachmentBean.ModelBean.CouponsBean> {
    public ChooseBikeCouponAdapter(Context context, int layoutResId) {
        super(context, layoutResId);
    }

    @Override
    protected void convert(BaseRcAdapterHelper helper, SettlementBikeDetailBean.AttachmentBean.ModelBean.CouponsBean item) {
        if (item.getType()==0){
            helper.getImageView(R.id.coupon_left).setImageResource(R.drawable.coupon_all);
        }else if (item.getType()==2){
            helper.getImageView(R.id.coupon_left).setImageResource(R.drawable.coupon_bike);
        }
        helper.setText(R.id.coupon_price, (int)item.getDenomination()+"");
        helper.setText(R.id.coupon_title, item.getTitle());
        helper.setText(R.id.coupon_content, item.getContent());
        helper.setText(R.id.coupon_fromData, TimeUtils.getFormatDate(item.getStartDate() + "", "yyyy-MM-dd"));
        helper.setText(R.id.coupon_endData, "至" + TimeUtils.getFormatDate(item.getEndDate() + "", "yyyy-MM-dd"));

    }
}
